home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr13 / tstse13.zip / SYNCH.S < prev    next >
Text File  |  1994-11-26  |  3KB  |  122 lines

  1. /* Synchronize the scrolling of windows for SemWare's TSE editor
  2.    V2.0. To make this SAL macro operational, invoke the main menu
  3.    (F10), choose "Macro", choose "Compile" and press Enter at
  4.    "Execute Macro".
  5.  
  6. ..................................................................
  7. Prof. Timo Salmi      Co-moderator of comp.archives.msdos.announce
  8. Moderating at garbo.uwasa.fi anonymous FTP archives  193.166.120.5
  9. Faculty of Accounting & Industrial Management; University of Vaasa
  10. Internet: ts@uwasa.fi   BBS +(358)-61-3170972; FIN-65101,  Finland
  11. */
  12.  
  13. // The contents of a simple help, tied later to the CtrlAlt-H key
  14. helpdef tHelpData
  15.   title = "SYNCH.S HELP"          // The help's caption
  16.   x = 10                          // Location
  17.   y = 3
  18.   // The actual help text
  19.   " Timo's synchronized scrolling of windows. "
  20.   ""
  21.   " If you have split the screen into two or "
  22.   " more windows, you can scroll the text in "
  23.   " the windows in unison with these commands. "
  24.   " The commands allow you to scroll either "
  25.   " all the windows or the two most current. "
  26.   ""
  27.   " You can use <F11> to invoke the command "
  28.   " menu after first exiting this help. "
  29.   ""
  30.   " Last updated Sat 26-November-1994 19:57:48 "
  31. end  /* tHelpData */
  32.  
  33. // Roll all windows down in unison
  34. proc timoSynchAllDown()
  35. integer wn, wn1
  36.   wn1 = WindowId()
  37.   RollDown()
  38.   while TRUE
  39.     NextWindow()
  40.     wn = WindowId()
  41.     if wn == wn1
  42.       break
  43.     endif
  44.     RollDown()
  45.   endwhile
  46. end timoSynchAllDown
  47.  
  48. // Roll all windows up in unison
  49. proc timoSynchAllUp()
  50. integer wn, wn1
  51.   wn1 = WindowId()
  52.   RollUp()
  53.   while TRUE
  54.     NextWindow()
  55.     wn = WindowId()
  56.     if wn == wn1
  57.       break
  58.     endif
  59.     RollUp()
  60.   endwhile
  61. end timoSynchAllUp
  62.  
  63. // Roll only two windows down in unison
  64. proc timoSynchDown()
  65.   RollDown()
  66.   if NextWindow()
  67.     RollDown()
  68.     PrevWindow()
  69.   endif
  70. end timoSynchDown
  71.  
  72. // Roll only two windows up in unison
  73. proc timoSynchUp()
  74.   RollUp()
  75.   if NextWindow()
  76.     RollUp()
  77.     PrevWindow()
  78.   endif
  79. end timoSynchUp
  80.  
  81. // New keys and menus **************************************************
  82. forward Menu tSynchMenu()
  83. forward proc tDisableNewKeys()
  84.  
  85. // Add the new key definitions
  86. keydef new_keys
  87.   <Shift CursorDown>    timoSynchAllDown()
  88.   <Shift CursorUp>      timoSynchAllUp()
  89.   <CtrlAlt 4>           timoSynchDown()
  90.   <CtrlAlt 6>           timoSynchUp()
  91.   <CtrlAlt 0>           tDisableNewKeys()
  92.   <CtrlAlt H>           QuickHelp(tHelpData)
  93.   <F11>                 tSynchMenu()
  94. end
  95.  
  96. // Disabling the new extra keys ***************************************
  97. proc tDisableNewKeys()
  98.   if YesNo("Disable the extra keys:") == 1 Disable(new_keys) endif
  99. end
  100.  
  101. // The Synch menu *****************************************************
  102. Menu tSynchMenu()
  103.   Title = "Timo's synchronize menu"
  104.   x = 44
  105.   y = 3
  106.   history
  107.   "Synch all &up      <Shift >"      , timoSynchAllUp()
  108.   "Synch all &down    <Shift >"      , timoSynchAllDown()
  109.   "",,Divide
  110.   "Syn&ch two down    <CtrlAlt 4>"    , timoSynchDown()
  111.   "S&ynch two up      <CtrlAlt 6>"    , timoSynchUp()
  112.   "",,Divide
  113.   "Disable &new keys  <CtrlAlt 0>"    , tDisableNewKeys()
  114.   "&Help              <CtrlAlt H>"    , QuickHelp(tHelpData)
  115.   "This Menu         <F11>"
  116. end  /* tSynchMenu */
  117.  
  118. proc Main()
  119.   Enable (new_keys)
  120.   tSynchMenu()
  121. end
  122.